package com.jby.seckill.controller;

import com.jby.seckill.service.IUserService;
import com.jby.seckill.vo.LoginVo;
import com.jby.seckill.vo.RespBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.function.IntUnaryOperator;

/**
 * @Description 注册前端控制器
 * @Author Jiang
 * @Date 2021/12/19 13:32
 * @Version 1.0.0
 */
@Controller
@RequestMapping("/register")
@Slf4j
public class RegisterController {

    @Autowired
    private IUserService userService;


    @RequestMapping("/toRegister")
    public String register() {
        return "register";
    }

    @RequestMapping("/doRegister")
    @ResponseBody
    public RespBean doRegister(@Valid LoginVo loginVo, HttpServletRequest request, HttpServletResponse response) {
        System.out.println(11);
        return userService.doRegister(loginVo,request,response);
    }
}
